

function saveStep1(data)
{
    var dynamicData = {};
    dynamicData['data'] = data;
    return $.ajax({
        url: URL + 'registration/save/step_1',
        data: dynamicData,
        dataType: 'json',
        type: 'post'
    });
}


var $save = $('#btnSave1');
var $form = $('#frmStep1');


$save.on('click',function(){
  //  validation here
   $form.submit();
});

$form.on('submit',function(e){
    e.preventDefault();

    $(this).on('valid',function(){
        var data= $form.serialize();
        saveStep1(data).done(function(result){
            if(result.status == true)
            {
               window.location.replace(URL+'registration/step_2');
            }
            else
            {
              alert(result.messages);
            }
        });
    });
});
